package com.pig.goods.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class PageController {
    //@Autowired
    //private GoodsService goodsService;
    //
    //@CrossOrigin
    //@GetMapping("/doGetGoodsPage")
    //public String getGoodsPage(Integer goodsId, Model model) {
    //    return "item.html";
    //}

    @GetMapping("/page/{pageUrl}")
    public String getPage(@PathVariable String pageUrl) {
        return pageUrl;
    }

    @RequestMapping("/page/jumpGoods/{goodsId}")
    public String getGoodsPage(@PathVariable Integer goodsId, Model model) {
        System.out.println(goodsId);
        model.addAttribute("goodsId", goodsId);
        return "item";
    }

    @RequestMapping("/page/jumpCate/{goodsId}")
    public String getCatePage(@PathVariable Integer goodsId, Model model) {
        System.out.println(goodsId);
        model.addAttribute("goodsId", goodsId);
        return "cate-update";
    }
}
